using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Joy.Erp.BasicArchives.Core.Filters;

namespace Joy.Erp.BasicArchives.ItemMasters
{
    [RemoteService(Name = BasicArchivesRemoteServiceConsts.RemoteServiceName)]
    [Area(BasicArchivesRemoteServiceConsts.ModuleName)]
    [ControllerName("ItemMaster")]
    [Route("api/basic-archives/item-master")]
    public partial class ItemMasterController : BasicArchivesController, IItemMasterAppService
    {
        protected IItemMasterAppService ItemMasterAppService => LazyServiceProvider.LazyGetRequiredService<IItemMasterAppService>();

        [HttpGet]
        [Route("{id}")]
        public Task<ItemMasterDto> GetAsync(Guid id)
        {
            return ItemMasterAppService.GetAsync(id);
        }

        [HttpGet]
        [Route("find")]
        public Task<ItemMasterDto> FindAsync(string filter)
        {
            return ItemMasterAppService.FindAsync(filter);
        }

        [HttpGet]
        [Route("find-by-source-key")]
        public Task<ItemMasterDto> FindBySourceKeyAsync(string sourceKey, string sourceType)
        {
            return ItemMasterAppService.FindBySourceKeyAsync(sourceKey, sourceType);
        }

        [HttpGet]
        public Task<PagedResultDto<ItemMasterDto>> GetListAsync(FilterRequestDto input)
        {
            return ItemMasterAppService.GetListAsync(input);
        }

        [HttpPost]
        [Route("query")]
        public Task<PagedResultDto<ItemMasterDto>> QueryAsync(FilterGroupRequestDto input)
        {
            return ItemMasterAppService.QueryAsync(input);
        }

        [HttpPost]
        public Task<ItemMasterDto> CreateAsync(ItemMasterCreateDto input)
        {
            return ItemMasterAppService.CreateAsync(input);
        }

        [HttpPut]
        [Route("{id}")]
        public Task<ItemMasterDto> UpdateAsync(Guid id, ItemMasterUpdateDto input)
        {
            return ItemMasterAppService.UpdateAsync(id, input);
        }

        [HttpDelete]
        [Route("{id}")]
        public Task DeleteAsync(Guid id)
        {
            return ItemMasterAppService.DeleteAsync(id);
        }
    }
} 